import React, { FC, ReactElement } from 'react'
import { NavBar } from 'antd-mobile'
import style from './index.scss'

import 'Assets/styles/fonts/iconfont.css'

interface IProps {
  title: string
  back?: boolean | (() => void)
  right?: ReactElement
}

const Header: FC<IProps> = ({ title, back, right }): ReactElement => {
  return (
    <div className={style['nav-bar']}>
      <NavBar className={`${style['am-navbar']}`} right={right} back={back ? '' : null} onBack={back as () => void}>
        {title}
      </NavBar>
    </div>
  )
}

export default Header
